import request from "@/utils/request";
import type { AxiosPromise } from "axios";
import type {
  ContentCollectionVO,
  ContentCollectionForm,
  ContentCollectionQuery,
} from "@/api/contentCollection/types";

/**
 * 查询统一内容合集列表
 * @param query
 * @returns {*}
 */

export const listContentCollection = (
  query?: ContentCollectionQuery
): AxiosPromise<ContentCollectionVO[]> => {
  return request({
    url: "/business/contentCollection/list",
    method: "get",
    params: query,
  });
};

/**
 * 查询统一内容合集详细
 * @param id
 */
export const getContentCollection = (
  id: string | number
): AxiosPromise<ContentCollectionVO> => {
  return request({
    url: "/business/contentCollection/" + id,
    method: "get",
  });
};

/**
 * 新增统一内容合集
 * @param data
 */
export const addContentCollection = (data: ContentCollectionForm) => {
  return request({
    url: "/business/contentCollection",
    method: "post",
    data: data,
  });
};

/**
 * 修改统一内容合集
 * @param data
 */
export const updateContentCollection = (data: ContentCollectionForm) => {
  return request({
    url: "/business/contentCollection",
    method: "put",
    data: data,
  });
};

/**
 * 删除统一内容合集
 * @param id
 */
export const delContentCollection = (
  id: string | number | Array<string | number>
) => {
  return request({
    url: "/business/contentCollection/" + id,
    method: "delete",
  });
};
